{include file="admintemplate/header.htm"}
<script src="./public/js/containspecial.js"></script>
<div class="title">修改栏目名称</div>
<div class="div_form">
    <div class="cont">
   		<div class="uinArea">
   			<label class="input-tips">栏目ID</label>
   			<input type="text" name="columnId" value="{$column.column_id}" class="inputOuter" readonly="readonly" disabled="disabled"/>
        </div>
         <div class="uinArea">
                <label class="input-tips">栏目名:</label>
                <input type="text" id="column_name" name="column_name" class="inputOuter" value="{$column.column_name}" />
                <span class="err_msg" id="tips-name"></span>
         </div>
         <div class="uinArea">
        	 <label class="input-tips">父栏目</label>
             <select id="column_pid" class="inputOuter" style="height:38px;">
                   <option value="0">顶层栏目</option>
                     {foreach $columnlist as $item}
                        <option value="{$item.column_id}" {if $item.column_id == $column.column_pid} selected="true" {/if} >{$item.column_name}</option>
                     {/foreach}
             </select>
             <span class="err_msg" id="tips-pid"></span> 
         </div>
         <div class="all_btn">
               <button id="mod" class="button_blue" style="width:180px;height:50px;">修&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;改</button>
         </div>
    </div>
</div>
<script>
var id = {$column.column_id};
{literal}
    $("#mod").click(function(){
        if($("#column_name").val() == ""){
            $("#tips-name").html("栏目名不能为空！");
            return false;
        }else if($("#column_name").val().length > 20){
            $("#tips-name").html("栏目名长度不能大于20！");
            return false;
        }else if(containSpecial($("#column_name").val())){
            $("#tips-name").html("栏目名不能包含特殊字符");
            return false;
        }else{
            $("#tips-name").html("");
        }
        
        if($("#column_pid").val() == id){
            $("#tips-pid").html("栏目的父栏目不能为自己！");
            return false;
        }else{
            $("#tips-pid").html("");
        }
        data = {
            "mod":"column",
            "act":"mod",
            "column_id":id,
            "column_pid":$("#column_pid").val(),
            "column_name":$("#column_name").val()
        };
        $.get("index.php",data,function(rtn){
            if($.trim(rtn) == "ok"){
                alertify.success("修改成功！");
                location.href = "index.php?mod=column&act=index";
            }else{
                alertify.error("修改失败！");
            }
        });
    });
{/literal}
</script>
{include file="admintemplate/footer.htm"}